package com.ruoyi.framework.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "minio") //自动注入配置内容 要求 属性名和配置名一致
public class MinioConfig {
    private String accessKey;
    private String accessSecret;
    private String url;
    private String bucket;

    /**
     * minio客户端对象*/
    @Bean
    public MinioClient createMc(){
        System.err.println(url);
        return MinioClient.builder().credentials(accessKey,accessSecret).endpoint(url).build();
    }
}
